package cn.com.mayue.guava.collections;

import com.google.common.collect.HashMultimap;
import org.junit.Test;

/**
 * Created by mayue on 2016/12/22.
 */
public class HashMultimapTest {
    @Test
    public void test() {
        //一个key对应多个值，key:set 格式，一个key对应的值不能重复
        HashMultimap<String, String> hashMultiMap = HashMultimap.create();
        hashMultiMap.put("test", "1");
        hashMultiMap.put("test", "2");
        hashMultiMap.put("test", "3");
        //重复过滤掉 底层用set
//        hashMultiMap.put("test", "3");
        System.out.println(hashMultiMap.get("test"));
    }

    @Test
    public void testKey(){
        HashMultimap<String, String> hashMultiMap = HashMultimap.create();
        hashMultiMap.put("test", "1");
        hashMultiMap.put("test", "2");
        hashMultiMap.put("test2", "3");
        hashMultiMap.put("test2", "4");

        System.out.println(hashMultiMap.keySet());
        System.out.println(hashMultiMap.asMap());
        System.out.println(hashMultiMap.keys());
    }
}
